class CreateComments < ActiveRecord::Migration
  def self.up
    create_table :comments do |t|
      t.column :article_id, :integer    	
      t.column :user_id, :integer
      t.column :body, :text
      t.column :created_at, :datetime
    end
    add_index :comments, :article_id
    add_column :articles, :comments_count, :integer
  end

  def self.down
    drop_table :comments
    remove_column :articles, :comments_count
  end
end
